//标签相关接口
import request from '@/utils/request'
import type {
  DeleteRequest,
  ArticleAddRequest,
  ArticleQueryRequest,
  ArticleUpdateRequest,
  PageArticle,
} from './type'
//项目用户相关的请求地址
enum API {
  LIST_URL = '/admin/article/list',
  DELETE_URL = '/admin/article/delete',
  ADD_URL = '/admin/article/add',
  UPDATE_URL = '/admin/article/update',
  DELETE_BATCH_URL = '/admin/article/deleteBatch',
  GET_INFO_URL = '/admin/article/info'
}

//获取标签列表接口
export const reqList = (data: ArticleQueryRequest) =>
  request.post<any, PageArticle>(API.LIST_URL, data)

//删除标签接口
export const reqDelete = (data: DeleteRequest) =>
  request.post<any, any>(API.DELETE_URL, data)

//新增标签接口
export const reqAdd = (data: ArticleAddRequest) =>
  request.post<any, any>(API.ADD_URL, data)

//修改标签接口
export const reqUpdate = (data: ArticleUpdateRequest) =>
  request.post<any, any>(API.UPDATE_URL, data)

export const reqDeleteBatch = (ids: any) =>
  request.post<any, any>(API.DELETE_BATCH_URL, { ids: ids })

export const reqGetById = (id: any): Promise<any> => {
  return request.get<any, any>(API.GET_INFO_URL + '/' + id);
}